import 'package:flutter/material.dart';
import 'package:flutter/services.dart';
import 'package:flutter_screenutil/flutter_screenutil.dart';
import 'package:flutter_smart_dialog/flutter_smart_dialog.dart';
import 'package:get/get.dart';
import 'package:hotpot/pages/login/server_page.dart';
import 'package:hotpot/pages/splash/splash_page.dart';
import 'package:hotpot/route/app_pages.dart';

void main() {
  // 设置应用程序的初始化配置
  WidgetsFlutterBinding.ensureInitialized();

  // 设置横屏显示
  SystemChrome.setPreferredOrientations([DeviceOrientation.landscapeLeft, DeviceOrientation.landscapeRight]);
  SystemChrome.setEnabledSystemUIMode(SystemUiMode.immersiveSticky);

  runApp(ScreenUtilInit(
    designSize: const Size(563, 393),
    minTextAdapt: true,
    splitScreenMode: true,
    builder: (_, child) {
      return GetMaterialApp(
        title: 'Ordering',
        theme: ThemeData(
          appBarTheme: const AppBarTheme(backgroundColor: Colors.white, surfaceTintColor: Colors.white),
          useMaterial3: true,
        ),
        home: const SplashPage(),
        routes: AppPages.pages,
        builder: FlutterSmartDialog.init(
          builder: (context, child) {
            return MediaQuery(data: MediaQuery.of(context), child: child!);
          },
        ),
      );
    },
  ));
}
